@extends('admin.layout.layout')
@section('content')
 

                <!-- /.col-lg-12 -->
            
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="dataTable_wrapper">
                                <div class="dataTables_wrapper form-inline dt-bootstrap no-footer" id="dataTables-example_wrapper">
                                    <div class="row">
                                    <form action="{{url('admin/comment/list')}}" method="get">

                                </div>
                                <div class="col-sm-6">
                                <div class="dataTables_filter" id="dataTables-example_filter">
                                        <label>
                                        
                                            <label>选择景点</label>
                                            <select name="sid" aria-controls="dataTables-example" class="form-control input-sm">
                                                @foreach($scenic as $k=>$v)
                                                <option value="{{$v->id}}">{{$v->name}}</option>
                                                <!-- <option value="{{$v->id}}" "{{$v->name}}"selected >{{$v->name}}</option> -->
                                                <!-- <option value="10" @if(!empty($pho['name']) && $request['num'] == 10) { selected } @endif>10</option> -->
                                                @endforeach
                                            </select>                                       
                                       
                                        </label>
                                        <button class="btn btn-primary">确定</button>
                                        </div>
                                    </div>
                                    </form>
                                </div>
                                <div class="row">
                                <div class="col-sm-12">
                                <table aria-describedby="dataTables-example_info" role="grid" class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example">
                                    <thead>
                                        <tr role="row">
                                        <th aria-label="Rendering engine: activate to sort column descending" aria-sort="ascending" style="width: 25px;" colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting_asc">ID</th>
                                        <th aria-label="Browser: activate to sort column ascending" style="width: 100px;" colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">景点名称</th>
                                        <th aria-label="Browser: activate to sort column ascending" style="width: 100px;" colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">用户名称</th>
                                        <th aria-label="Platform(s): activate to sort column ascending" style="width: 500px;" colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">评论内容</th>
                                         <th aria-label="Engine version: activate to sort column ascending" style="width: 120px;" colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">点评图片</th>
                                         <th aria-label="Engine version: activate to sort column ascending" style="width: 120px;" colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">点评时间</th>
                                         <th aria-label="Engine version: activate to sort column ascending" style="width: 120px;" colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">管理员回复</th>

                                        <th aria-label="CSS grade: activate to sort column ascending" style="width: 140px;" colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    @foreach($com as $k=>$v)                                        
                                    <tr role="row" class="gradeA odd">
                                            <td class="sorting_1 sid">{{$v->id}}</td>
                                            <td class="sorting_1 sid">{{$v->sname}}</td>
                                            <td class="sorting_1 sid">{{$v->uname}}</td>
                                            <td>{{$v->contents}}</td>
                                            <td><img src="/public/uploads/s_{{$v->tupian}}"></td>
                                            <td>{{$v->ctime}}</td>
                                            <td>{{$v->reply}}</td>
                                            

                                            <td class="center">
                                                <a href="" class="fa fa-trash-o delete">删除</a>
                                                |
                                                <a href="{{url('/admin/comment/edit',['id'=>$v->id])}}" class="fa fa-wrench">回复</a>
                                            </td>
                                        </tr>
                                    @endforeach
                                    </tbody>
                                </table>
                                </div>
                                </div>
                              <div class="row">
                               
                               <div class="col-sm-6">
                                <div id="dataTables-example_paginate" class="dataTables_paginate paging_simple_numbers">
                                {!! $com->appends($request)->render() !!}
                                </div>
                               </div>
                              </div>
                            </div>
                            <!-- /.table-responsive -->

                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            

@endsection

@section('myjs')
<script type="text/javascript">
$.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
});
    $('.delete').click(function(){
        var id = $(this).parents('tr').find('.sid').html();
        var dd = $(this);
      //发送ajax
      $.get('/admin/comment/delete',{id:id},function(data){
        if(data == 1){
            dd.parents('tr').remove();
        }else{
            alert('失败');
        }
      })
        return false;
    })
</script>
@endsection